PREFIX ?= /usr/local
BINNAME = ai
INSTALL_DIR = $(PREFIX)/bin

.PHONY: all
all: build

.PHONY: build
build:
	go build -o $(BINNAME)
	GOOS=windows GOARCH=amd64 go build -o $(BINNAME).exe

.PHONY: install
install: build
	install -d $(INSTALL_DIR)             
	install -m 755 $(BINNAME) $(INSTALL_DIR)
	@echo "Installed to $(INSTALL_DIR)/$(BINNAME)"

.PHONY: uninstall
uninstall:
	rm -f $(INSTALL_DIR)/$(BINNAME)
	@echo "Removed $(INSTALL_DIR)/$(BINNAME)"

.PHONY: clean
clean:
	rm -f $(BINNAME) $(BINNAME).exe